import unittest, ddt, requests
from HTMLTestRunner import HTMLTestRunner
from woniuboss import qwe
t=qwe.read_excel()
t.excel_login("Read.xlsx",1)


@ddt.ddt
class Testwoniuboss():
    @classmethod
    def setUpClass(cls):
        print("初始化")
    @ddt.data(*t.excel_login("Read.xlsx",1))
    def test001(self, data):
        student_id = data['student_id']
        salary = data['salary']
        comm = data['comm']
        remark = data['remark']
        ses=requests.session()
        res0 = self.s.post(url="http://192.168.2.167:8080/woniuboss2.5/",
                           data={"userName": "wncd000", "userPass": "woniu123", "checkcode": "0000"})
        result = ses.get(url='http://192.168.2.167:8080/woniuboss2.5/interview',
                         data={'m.minterview_student_id': student_id, 'm.intent_salary': salary,
                               'm.comm': comm, 'm.remark': remark})
        print(res0.text)
        assert "success" in res0.text

    @classmethod
    def tearDownClass(cls):
        print("结束")


if __name__ == '__main__':
    # unittest.main()
    suite = unittest.TestSuite()
    suite.addTests(unittest.TestLoader().loadTestsFromTestCase(Testwoniuboss))
    with open("test.html", "w", encoding="utf8") as file:
        runner = HTMLTestRunner(stream=file, verbosity=2, title="测试报告")
        runner.run(suite)
